package com.suntop.carousel.qlmediaplay.video.player;

import android.content.Context;
import android.content.res.AssetFileDescriptor;
import android.view.Surface;
import android.view.SurfaceHolder;

import com.suntop.carousel.qlmediaplay.field.Field_Scale;

import java.util.Map;

import androidx.annotation.IntRange;

public interface IVideoPlayer {
    void initPlayer(Context context);

    IVideoPlayer setPlayUrl(String url);

    IVideoPlayer setPlayUrl(String url, Map<String, String> header);

    IVideoPlayer setScaleType(@IntRange(from = Field_Scale.Scale_Default, to = Field_Scale.Scale_Crop)
                                      int type);

    IVideoPlayer setAssetFileDescriptor(AssetFileDescriptor fd);

    IVideoPlayer setVideoTag(String tag);

    IVideoPlayer setLoop(boolean isLoop);

    IVideoPlayer setVolume(float left, float right);

    IVideoPlayer setPlaySpeed(float speed);

    IVideoPlayer setIVideoPlayerEventListener(IVideoPlayerEventListener eventListener);

    /**
     * 设置渲染视频的View,主要用于TextureView
     */
    IVideoPlayer setSurface(Surface surface);

    /**
     * 设置渲染视频的View,主要用于SurfaceView
     */
    IVideoPlayer setDisplay(SurfaceHolder holder);

    /**
     * 调整进度
     */
    IVideoPlayer seekTo(long time);

    //获取的类
    boolean isOnPlaying();//是否在播放状态 缓存

    boolean isNeedRest();

    boolean isReBack();

    boolean mIsPrepared();

    String takePlayUrl();

    String takePlayTag();

    int getPlayState();

    /**
     * 获取当前播放的位置
     */
    long getCurrentPosition();

    /**
     * 获取视频总时长
     */
    long getDuration();

    /**
     * 获取缓冲百分比
     */
    int getBufferedPercentage();

    /**
     * 获取播放速度
     */
    float getSpeed();

    /**
     * 获取当前缓冲的网速
     */
    long getTcpSpeed();

    int getVideoWidth();

    int getVideoHeight();

    void setIsPrepared(boolean isPrepared);
    void setIsReBack(boolean isReBack);

    /**
     * 准备开始播放（异步）
     */
    void prepareAsync();

    void start();

    void pause();

    void stop();

    void reset();

    void release();


}
